home *** CD-ROM | disk | FTP | other *** search
/ Chip 2006 June (Extra) / CHIP 2006-06.3.iso / program / opensource / clamav-devel.exe / sosdg / clamav-devel.nsi next >
Encoding:
Text File  |  2006-05-16  |  10.3 KB  |  283 lines

  1. ; NSIS Script For ClamAV
  2. ; Installer v4.24p1 by Brian Bruns
  3. ; Uses installer DLLs from:
  4. ;
  5. ; cpudesc.dll
  6. ; Peter Mason, CSIRO DEM MMTG.  peter.mason@csiro.au
  7. ;     NSIS plug-in for getting a bit of CPU information.
  8. ;     Version 1.2, July 2003.
  9.  
  10. !include "Sections.nsh"
  11. !include "LogicLib.nsh"
  12.  
  13. ;Title Of Your Application
  14. Name "ClamAV For Windows 0.88.2-1/20060516 - Cgw1.5.20snap Build"
  15.  
  16. ;Do A CRC Check
  17. CRCCheck On
  18.  
  19. ;Output File Name
  20. OutFile "installers\clamav-0.88.2-1.exe"
  21.  
  22. ;License Page Introduction
  23. LicenseText "You must agree to this license before installing."
  24.  
  25. ;License Data
  26. LicenseData "C:\clamav-devel\Copying.txt"
  27.  
  28. ;The Default Installation Directory
  29. InstallDir "C:\clamav-devel"
  30.  
  31. ;The text to prompt the user to enter a directory
  32. DirText "Please select the folder below you wish to install to.  Do not change it unless you absolutely need to, as certain parts of ClamAV are hardwired to the C:\clamav-devel directory."
  33.  
  34. ShowInstDetails show
  35. SetCompress Auto
  36. SetCompressor lzma
  37. SetOverwrite IfNewer
  38. SetDatablockOptimize on
  39.  
  40. Page license
  41. Page components
  42. Page directory
  43. Page instfiles
  44. UninstPage uninstConfirm
  45. UninstPage instfiles
  46.  
  47. InstType "Standard"
  48. InstType "Full"
  49. InstType "Minimal"
  50.  
  51. ;LicenseForceSelection checkbox "I have read the license and agree."
  52.  
  53. Section "ClamAV Base (required)"
  54.   SectionIn 1 2 3 RO
  55.   ${If} ${FileExists} "$INSTDIR\bin\clamd.exe"
  56.           ExecWait '"$INSTDIR\bin\killall.exe" clamd.exe'
  57.           ExecWait '"$INSTDIR\bin\killall.exe" freshclam.exe'
  58.           ExecWait '"$INSTDIR\bin\killall.exe" clamdscan.exe'
  59.           ExecWait '"$INSTDIR\bin\killall.exe" clamscan.exe'
  60.           Delete "$INSTDIR\clamd.sock"
  61.           MessageBox MB_OK|MB_ICONEXCLAMATION "An existing install of ClamAV For Windows was detected, and all running processes were killed to ensure a clean upgrade.  Please do not forget to restart the clamd or freshclam daemon if you use them."          
  62.   ${EndIf}
  63.           
  64.   SetOutPath $INSTDIR\bin
  65.   File /r "C:\clamav-devel\bin\clam*.exe"
  66.   File /r "C:\clamav-devel\bin\freshclam.exe"
  67.   File /r "C:\clamav-devel\bin\sigtool.exe"
  68.   ;File /r "C:\clamav-devel\bin\cygclamav-1.dll"
  69.   SetOutPath $INSTDIR
  70.   File /r "C:\clamav-devel\man"
  71.   File /r "C:\clamav-devel\share"
  72.   File /r "C:\clamav-devel\sosdg"
  73.   SetOverwrite off
  74.   File /r "C:\clamav-devel\etc"
  75.   SetOverwrite IfNewer
  76.   File /r "C:\clamav-devel\AUTHORS"
  77.   File /r "C:\clamav-devel\BUGS"
  78.   File /r "C:\clamav-devel\ChangeLog"
  79.   File /r "C:\clamav-devel\FAQ"
  80.   File /r "C:\clamav-devel\INSTALL"
  81.   File /r "C:\clamav-devel\NEWS"
  82.   File /r "C:\clamav-devel\README"
  83.   File /r "C:\clamav-devel\TODO"
  84.   File /r "C:\clamav-devel\*.txt"
  85.   File /r "C:\clamav-devel\*.bat"
  86.   File /r "C:\clamav-devel\clamav-qs1.pdf"
  87.   CreateDirectory $INSTDIR\log
  88.   CreateDirectory $INSTDIR\tmp
  89.   ; Write the uninstall keys for Windows
  90.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ClamAV" "DisplayName" "ClamAV (remove only)"
  91.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ClamAV" "UninstallString" "$INSTDIR\uninstall.exe"
  92.   SetOutPath $INSTDIR
  93.   WriteUninstaller "uninstall.exe"
  94.   SetOutPath $INSTDIR\sosdg
  95.   File /r "C:\installer scripts\clamav-devel.nsi"
  96. SectionEnd
  97.  
  98. Section "Cygwin Support Files (Required)"
  99.   SectionIn 1 2 3 RO
  100.   SetOutPath $INSTDIR\bin
  101.   File /r "C:\clamav-devel\bin\cygwin1.dll"
  102.   File /r "C:\clamav-devel\bin\cygbz2-1.dll"
  103.   File /r "C:\clamav-devel\bin\cygz.dll"
  104.   File /r "C:\clamav-devel\bin\cyggmp-3.dll"
  105.   File /r "C:\clamav-devel\bin\cygminires.dll"
  106.   File /r "C:\clamav-devel\bin\mount.exe"
  107.   File /r "C:\clamav-devel\bin\umount.exe"
  108.   File /r "C:\clamav-devel\bin\killall.exe"
  109.   File /r "C:\clamav-devel\bin\unzip.exe"
  110.   ; Determine CPU type for which GMP to install
  111.   ; Produces output similar to:
  112.   ; INTELP=d AMD=add PPRO=b MMX=d SSE=b SSE2=b 3DNOW=d ARCH=dd LEVEL=dd NCPU=dd MHZ=ddddd RAM=dddd
  113.   cpudesc::tell
  114.   Pop $0
  115.   StrCpy $1 $0 1, 28
  116.   IntFmt $2 "%u" $1
  117.   ; If no MMX support, install the i386 DLL which actually works on older processors
  118.   ${If} $2 = 0
  119.        MessageBox MB_OK|MB_ICONEXCLAMATION "We've detected that you are using a non-MMX enabled processor.  Switching support DLL files to i386 compatibility versions."
  120.        File /r "C:\clamav-devel\bin\cyggmp-i386-3.dll" 
  121.        Delete /REBOOTOK $INSTDIR\bin\cyggmp-3.dll
  122.        Rename /REBOOTOK $INSTDIR\bin\cyggmp-i386-3.dll $INSTDIR\bin\cyggmp-3.dll
  123.   ${EndIf}
  124. SectionEnd
  125.  
  126. Section "Force GMP For 386/486/pentium with no mmx"
  127.   ;SectionIn
  128.   SetOutPath $INSTDIR\bin
  129.   File /r "C:\clamav-devel\bin\cyggmp-i386-3.dll"
  130.   Delete /REBOOTOK $INSTDIR\bin\cyggmp-3.dll
  131.   Rename /REBOOTOK $INSTDIR\bin\cyggmp-i386-3.dll $INSTDIR\bin\cyggmp-3.dll
  132. SectionEnd
  133.  
  134. Section "Start Menu Shortcuts"
  135.   SectionIn 1 2
  136.   ;Add Shortcuts
  137.   SetOutPath $INSTDIR
  138.   CreateDirectory "$SMPROGRAMS\ClamAV"
  139.   CreateShortCut "$SMPROGRAMS\ClamAV\Start Clamd.lnk" "$INSTDIR\start-clamd.bat" "" "$INSTDIR\start-clamd.bat" 0
  140.   CreateShortCut "$SMPROGRAMS\ClamAV\Stop Clamd.lnk" "$INSTDIR\stop-clamd.bat" "" "$INSTDIR\stop-clamd.bat" 0
  141.   CreateShortCut "$SMPROGRAMS\ClamAV\Freshclam (virus updates).lnk" "$INSTDIR\bin\freshclam.exe" "" "$INSTDIR\bin\freshclam.exe" 0
  142.   CreateShortCut "$SMPROGRAMS\ClamAV\Readme (Windows Version).lnk" "$INSTDIR\readme-win32.txt" "" "$INSTDIR\readme-win32.txt" 0
  143.   CreateShortCut "$SMPROGRAMS\ClamAV\Readme (Author Version).lnk" "$INSTDIR\readme" "" "$INSTDIR\readme" 0
  144.   CreateShortCut "$SMPROGRAMS\ClamAV\License.lnk" "$INSTDIR\copying.txt" "" "$INSTDIR\copying.txt" 0
  145.   CreateShortCut "$SMPROGRAMS\ClamAV\ClamAV Quickstart.lnk" "$INSTDIR\clamav-qs1.pdf" "" "$INSTDIR\clamav-qs1.pdf" 0
  146.   CreateShortCut "$SMPROGRAMS\ClamAV\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  147. SectionEnd
  148.  
  149. Section "Cygwin Registry Values (Recommended)"
  150.   SectionIn 1 2 3
  151.     CreateDirectory C:\cygwin\tmp
  152.     ${If} ${FileExists} "C:\cygwin\bin\cygwin1.dll"
  153.         ; We know cygwin is apparently already installed...
  154.           MessageBox MB_OK|MB_ICONEXCLAMATION "Warning: Existing Cygwin installation found.  Please make sure you only have one version of the cygwin1.dll on your system or you WILL have problems!"
  155.     ${Else}
  156.         CreateDirectory C:\cygwin\tmp
  157.         ExecWait '"$SYSDIR\CACLS.EXE"  C:\cygwin\tmp /E /P Everyone:F'
  158.         ExecWait '"$INSTDIR\bin\mount.exe" -b C:\cygwin /'
  159.         WriteRegStr HKLM "SOFTWARE\Cygnus Solutions\Cygwin\mounts v2" "cygdrive prefix" "/cygdrive"
  160.         WriteRegDWORD HKLM "SOFTWARE\Cygnus Solutions\Cygwin\mounts v2" "cygdrive flags" 0x00000022
  161.     ${EndIf}
  162.  
  163.     ;ExecWait '"$SYSDIR\CACLS.EXE"  $INSTDIR\log /E /P Everyone:F'
  164.     ;ExecWait '"$SYSDIR\CACLS.EXE"  $INSTDIR\tmp /E /P Everyone:F'
  165. SectionEnd
  166.  
  167. ; Obsoleted - dont use
  168. ;Var WinType
  169. ;Section "TMPDIR And Permissions (Recommended)"
  170. ;    Call GetWindowsVersion
  171. ;    Pop $R0
  172. ;    ${If} $R0 == "95"
  173. ;        StrCpy "$WinType" "9x"
  174. ;    ${ElseIf} $R0 == "98"
  175. ;        StrCpy "$WinType" "9x"
  176. ;    ${ElseIf} $R0 == "ME"
  177. ;        StrCpy "$WinType" "9x"
  178. ;    ${ElseIf} $R0 == "NT 4.0"
  179. ;        StrCpy "$WinType" "NT"
  180. ;    ${ElseIf} $R0 == "2000"
  181. ;        StrCpy "$WinType" "NT"
  182. ;    ${ElseIf} $R0 == "XP"
  183. ;        StrCpy "$WinType" "NT"
  184. ;    ${ElseIf} $R0 == "2003"
  185. ;        StrCpy "$WinType" "NT"
  186. ;    ${Else}
  187. ;        StrCpy "$WinType" "Unknown"
  188. ;    ${Endif}    
  189. ;    
  190. ;    CreateDirectory C:\cygwin\tmp
  191. ;    
  192. ;    ${If} $WinType == "NT"
  193. ;        ExecWait '"$SYSDIR\CACLS.EXE"  C:\cygwin\tmp /E /P Everyone:F'
  194. ;        ExecWait '"$SYSDIR\CACLS.EXE"  $INSTDIR\log /E /P Everyone:F'
  195. ;        ExecWait '"$SYSDIR\CACLS.EXE"  $INSTDIR\tmp /E /P Everyone:F'
  196. ;
  197. ;    ${Endif}
  198. ;SectionEnd
  199.  
  200. Section "Tar File Support (Recommended)"
  201.   SectionIn 1 2 3
  202.   SetOutPath $INSTDIR\bin
  203.   File /r "C:\clamav-devel\bin\tar.exe"
  204.   File /r "C:\clamav-devel\bin\cygiconv-2.dll"
  205.   File /r "C:\clamav-devel\bin\cygintl-2.dll"
  206. SectionEnd
  207.  
  208.  
  209. Section "Contributed Tools"
  210.   SectionIn 2
  211.   SetOutPath $INSTDIR
  212.   File /r "C:\clamav-devel\contrib"
  213.   File /r "C:\clamav-devel\examples"
  214.   File /r "C:\clamav-devel\thirdparty"
  215.   CreateDirectory "$SMPROGRAMS\ClamAV\Tools"
  216.   CreateShortCut "$SMPROGRAMS\ClamAV\Tools\Setup Clamd Service.lnk" "$INSTDIR\thirdparty\runclamd" "" "$INSTDIR\thirdparty\runclamd" 0
  217.   CreateShortCut "$SMPROGRAMS\ClamAV\Tools\Clamscan Wrapper.lnk" "$INSTDIR\thirdparty\runclamscan" "" "$INSTDIR\thirdparty\runclamscan" 0
  218.   CreateShortCut "$SMPROGRAMS\ClamAV\Tools\About Third Party Tools.lnk" "$INSTDIR\thirdparty\readme.txt" "" "$INSTDIR\thirdparty\readme.txt" 0
  219. SectionEnd
  220.  
  221. Section "ClamAV Virus Test Files"
  222.   SectionIn 1 2
  223.   SetOutPath $INSTDIR
  224.   File /r "C:\clamav-devel\test"
  225. SectionEnd 
  226.  
  227. Section "Documentation"
  228.   SectionIn 1 2
  229.   SetOutPath $INSTDIR
  230.   File /r "C:\clamav-devel\docs"
  231.   CreateShortCut "$SMPROGRAMS\ClamAV\Documentation (HTML).lnk" "$INSTDIR\docs\html\clamdoc.html" "" "$INSTDIR\docs\html\clamdoc.html" 0
  232.   CreateShortCut "$SMPROGRAMS\ClamAV\Documentation (PDF).lnk" "$INSTDIR\docs\clamdoc.pdf" "" "$INSTDIR\docs\clamdoc.pdf" 0
  233. SectionEnd
  234.  
  235. Section "Development"
  236.   SectionIn 2
  237.   SetOutPath $INSTDIR
  238.   File /r "C:\clamav-devel\lib"
  239.   File /r "C:\clamav-devel\include"
  240. SectionEnd
  241.  
  242. Section "Update virus definitions when install is complete"
  243.   SectionIn 1 2 3
  244.   ExecWait '$INSTDIR\bin\freshclam.exe'
  245. SectionEnd
  246.  
  247. ;Section "ClamAV Source Code (GPL)"
  248. ;  CreateDirectory $INSTDIR\src
  249. ;  SetOutPath $INSTDIR\src
  250. ;  NSISdl::download http://www.sosdg.org/clamav-win32/clamav-devel-latest.src.bz2 clamav-devel-latest.src.bz2
  251. ;  Pop $R0 ;Get the return value
  252. ;  StrCmp $R0 "success" +3
  253. ;   MessageBox MB_OK "Download failed: $R0"
  254. ;    Quit
  255. ;SectionEnd
  256.  
  257. Section "Fix Permissions (recommended)"
  258.   SectionIn 1 2 3
  259.     ExecWait 'echo y|"$SYSDIR\CACLS.EXE" $INSTDIR /T /P Administrator:F Everyone:F'
  260. SectionEnd
  261.  
  262.  
  263. UninstallText "This will uninstall ClamAV from your system"
  264.  
  265. Section Uninstall
  266.   ;Kill running procs
  267.   ExecWait '"$INSTDIR\bin\killall.exe" clamd.exe'
  268.   ExecWait '"$INSTDIR\bin\killall.exe" freshclam.exe'
  269.   ExecWait '"$INSTDIR\bin\killall.exe" clamdscan.exe'
  270.   ExecWait '"$INSTDIR\bin\killall.exe" clamscan.exe'
  271.  
  272.  
  273.   ;Delete Files
  274.   RMDir /r "$INSTDIR"
  275.  
  276.   ; Additional Files To Remove During Uninstall
  277.   RMDir /r "$SMPROGRAMS\ClamAV"
  278.   ;Delete Uninstaller And Unistall Registry Entries
  279.   Delete "$INSTDIR\uninstall.exe"
  280.   DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\ClamAV"
  281.   DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ClamAV"
  282.   RMDir "$INSTDIR"
  283. SectionEnd